//
//  PhoneFieldView.m
//  OnionHome
//
//  Created by fengjie on 2019/9/13.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "PhoneFieldView.h"

@implementation PhoneFieldView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
-(void)createUI{
    
    UIView * lineView = UIView.new;
    lineView.backgroundColor = UIColorFromRGB(0xE9EEE7);
    
    [self addSubview:self.leftName];
    [self addSubview:self.textFile];
    [self addSubview:lineView];
    
    [self.leftName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(0);
        make.centerY.mas_equalTo(self.textFile);
        make.width.mas_equalTo(50);
    }];
    [self.textFile mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.mas_equalTo(0);
        make.left.mas_equalTo(self.leftName.mas_right).offset(10);
    }];
    
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.height.mas_equalTo(0.5);
        make.top.mas_equalTo(self.textFile.mas_bottom).offset(0);
    }];
}
#pragma mark ---懒加载

-(UILabel*)leftName{
    if(!_leftName){
        _leftName=[UILabel new];
        _leftName.textColor=UIColorFromRGB(0x273323);
        _leftName.text = @"+86";
        _leftName.font =SYSTEMFONT(16);

    }
    return _leftName;
}

-(UITextField*)textFile{
    if(!_textFile){
        _textFile=[UITextField new];
        _textFile.placeholder = @"输入手机号";
        _textFile.font =SYSTEMFONT(16);
    }
    return _textFile;
}
@end
